home *** CD-ROM | disk | FTP | other *** search
/ Champak 103 / Vol 103.iso / games / x_traini.swf / scripts / frame_3 / DoAction.as
Text File  |  2010-03-13  |  3KB  |  154 lines

  1. function detectKey(obj, iMoveDis)
  2. {
  3.    if(Key.isDown(Key.UP))
  4.    {
  5.       _root.iTouch = _root.iTouch + 1;
  6.       if(0 < obj._y - iMoveDis)
  7.       {
  8.          obj._y -= iMoveDis;
  9.       }
  10.    }
  11.    else if(Key.isDown(Key.DOWN))
  12.    {
  13.       _root.iTouch = _root.iTouch + 1;
  14.       if(obj._y + iMoveDis < _root.I_SCREEN_HEIGHT)
  15.       {
  16.          obj._y += iMoveDis;
  17.       }
  18.    }
  19.    if(Key.isDown(Key.LEFT))
  20.    {
  21.       _root.iTouch = _root.iTouch + 1;
  22.       if(0 < obj._x - iMoveDis)
  23.       {
  24.          obj._x -= iMoveDis;
  25.       }
  26.    }
  27.    else if(Key.isDown(Key.RIGHT))
  28.    {
  29.       _root.iTouch = _root.iTouch + 1;
  30.       if(obj._x + iMoveDis < _root.I_SCREEN_WIDTH)
  31.       {
  32.          obj._x += iMoveDis;
  33.       }
  34.    }
  35. }
  36. function genBullet(sB, iB, iT)
  37. {
  38.    if(iT == 0)
  39.    {
  40.       _root.attachMovie(sB,sB + iB,iB);
  41.       _root[sB + iB].mcRealBullet.iBulletV = _root.iBulletV;
  42.       _root[sB + iB].mcRealBullet.iType = iT;
  43.       _root[sB + iB].mcRealBullet.gotoAndStop(random(5) + 1);
  44.    }
  45.    else if(iT == 1)
  46.    {
  47.       _root.mcStatus.gotoAndPlay("highSpeed");
  48.       _root.attachMovie(sB,sB + iB,iB);
  49.       _root[sB + iB].mcRealBullet.iBulletV = _root.iBulletV * 1.5;
  50.       _root[sB + iB].mcRealBullet.iType = iT;
  51.       _root[sB + iB].mcRealBullet.gotoAndStop("highSpeed");
  52.    }
  53.    else if(iT == 2)
  54.    {
  55.       _root.mcStatus.gotoAndPlay("tracing");
  56.       _root.attachMovie(sB,sB + iB,iB);
  57.       _root[sB + iB].mcRealBullet.iBulletV = _root.iBulletV;
  58.       _root[sB + iB].mcRealBullet.iType = iT;
  59.       _root[sB + iB].mcRealBullet.gotoAndStop("tracing");
  60.    }
  61. }
  62. function getRank(i)
  63. {
  64.    if(i < 3)
  65.    {
  66.       return "Protozoan!";
  67.    }
  68.    if(i < 6)
  69.    {
  70.       return "Monkey cup!";
  71.    }
  72.    if(i < 9)
  73.    {
  74.       return "Coelenterate!";
  75.    }
  76.    if(i < 12)
  77.    {
  78.       return "Echinoderm!";
  79.    }
  80.    if(i < 15)
  81.    {
  82.       return "Reptile!";
  83.    }
  84.    if(i < 18)
  85.    {
  86.       return "Mammal!";
  87.    }
  88.    if(i < 21)
  89.    {
  90.       return "Primate!";
  91.    }
  92.    if(i < 24)
  93.    {
  94.       return "Human being!";
  95.    }
  96.    if(i < 27)
  97.    {
  98.       return "Sportsman!";
  99.    }
  100.    if(i < 30)
  101.    {
  102.       return "Olympic champion!";
  103.    }
  104.    if(i < 33)
  105.    {
  106.       return "Street fighter!";
  107.    }
  108.    if(i < 36)
  109.    {
  110.       return "King of fighter!";
  111.    }
  112.    if(i < 39)
  113.    {
  114.       return "X-Man!";
  115.    }
  116.    if(i < 42)
  117.    {
  118.       return "Spiderman!";
  119.    }
  120.    if(i < 45)
  121.    {
  122.       return "Superman!";
  123.    }
  124.    if(i < 48)
  125.    {
  126.       return "Sprite!";
  127.    }
  128.    if(i < 51)
  129.    {
  130.       return "Angel!";
  131.    }
  132.    return "God!";
  133. }
  134. var I_SCREEN_WIDTH = 400;
  135. var I_SCREEN_HEIGHT = 300;
  136. var iBulletV = 3;
  137. var iRoleV = 2;
  138. var iDropStep = 3;
  139. var iFPS = 24;
  140. var I_TRACING_ACC = 2;
  141. var S_BULLET = "mcBullet";
  142. var I_HIGHSPEED_STEP = 4;
  143. var I_TRACING_STEP = 5;
  144. var sndBoom = new Sound(mcRole);
  145. sndBoom.attachSound("sndBoom");
  146. var sndBg = new Sound(_root);
  147. sndBg.attachSound("sndBg");
  148. var sndNormal = new Sound();
  149. sndNormal.attachSound("sndNormal");
  150. var sndHighspeed = new Sound();
  151. sndHighspeed.attachSound("sndHighspeed");
  152. var sndTracing = new Sound();
  153. sndTracing.attachSound("sndTracing");
  154.